package org.yscz.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
import org.yscz.webSocket.WebSocket;
import org.yscz.webSocket.service.WebSocketService;

/**
 * @program: pe
 * @description: WebSocket配置类
 * @author: muqs
 * @create: 2021-08-24 14:31
 **/
@Configuration
public class WebSocketConfig {

    /*使用@ServerEndpoint创立websocket endpoint*/
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

    @Autowired
    public void setWebSocketService(WebSocketService webSocketService) {
        WebSocket.webSocketService = webSocketService;
    }
}
